<?php
class VideoModule extends fvModule {

	function __construct () {
	    $moduleName = strtolower(substr(__CLASS__, 0, -6));
	    parent::__construct(fvSite::$fvConfig->get("modules.{$moduleName}.smarty.template"), 
	                        fvSite::$fvConfig->get("modules.{$moduleName}.smarty.compile"), 
	                        fvSite::$Layoult);
	}
	
	function showIndex($params) {
	    $pager = new fvPager(VideoManager::getInstance());
        $this->__assign('Videos', $pager->paginate());
        return $this->__display("video_index.tpl");
	}
	
	function showOne($params) {
	    $request = fvRequest::getInstance();
        if (!$Video = VideoManager::getInstance()->getByPk($request->getRequestParameter('id'))) {
            $Video = new Video();
            
        }
        fvSite::$Layoult->setTitle(fvSite::$Layoult->getTitle().' > Видео > '.$Video->name);
        $this->__assign(array(
            'Video' => $Video,
        ));
        return $this->__display('video_one.tpl');
	}
	
}
?>